from fastapi import FastAPI
app = FastAPI()
from pydantic import BaseModel
from datetime import datetime
import uvicorn

class MyClassModel(BaseModel):
    question: str


@app.get("/")
def read_root():
    return {"Hello": "World"}



@app.post("/qwen2/api")
def create_myclass(myclass: MyClassModel):
    t1 = datetime.now()

    question=myclass.question
    answer=question

    t2 = datetime.now()
    second = (t2 - t1).total_seconds()
    print(f"耗时{second}")

    return {"output": f"{answer}"}


if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8091)